<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:a4j="http://richfaces.org/a4j">
	
<body> 
 <ui:composition template="/templates/default/template.xhtml">
    <ui:define name="body">
     <h:panelGrid columns="1" style="margin-left:5px;width:100%">
    	<!--  tieu de -->
    	<h:panelGrid columns="3" styleClass="columPanelbaritemTitle">
					<h:graphicImage value="/templates/default/images/left-heading_01.jpg" style="margin-left:-4px;margin-bottom:0px"></h:graphicImage>
			  		<h:outputText value="Thêm vị trí lưu trữ" styleClass="panelbaritemTitle"></h:outputText>
					<h:graphicImage value="/templates/default/images/left-heading_03.jpg"></h:graphicImage>
		 </h:panelGrid>
	  	<!-- ket thuc tieu de -->
		<!-- phan noi dung phia duoi -->	  
    	<h:panelGrid columns="1" styleClass="panelGridBody">
    			<!-- Bat dau noi dung ben trong -->
    			
		    <rich:panel style="background:#FFFFFF">
		    <h:form id="taomoidoanra">    
   	    	<h:panelGrid columns="1" style="margin-left:13px;">
		       		<h:outputText id="idError" value="#{viTriLuuTru.error}" style=" color: red;"></h:outputText>
				</h:panelGrid>
				<h:panelGrid columns="2" style="margin-left:13px;">
		     		<h:outputText value="Tên tủ(*): " style="margin-left:20px;" styleClass="inputText" ></h:outputText>
		    		<h:inputText id="tenTu" value="#{viTriLuuTru.viTriTu}" size="20"/>
		    		
		    		<h:outputText value="Ngăn tủ(*): " style="margin-left:20px;" styleClass="inputText" ></h:outputText>
		    		<h:inputText id="nganTu" value="#{viTriLuuTru.nganTrongTu}" size="20"/>
		    					
					<h:outputText value="Mô tả : " style="margin-left:20px;" styleClass="inputText" ></h:outputText>
		    		<h:inputText id="moTa" value="#{viTriLuuTru.moTa}" size="20"/>
		    	</h:panelGrid>
					<h:panelGrid columns="3" style="margin-left:190px;margin-top:10px;margin-bottom:1px">
			    	<a4j:commandButton value="Thêm" size="15" styleClass="Button" action="#{viTriLuuTru.themTao}">
			    	</a4j:commandButton>
			    	<a4j:commandButton value="Cập nhật" size="15" styleClass="Button" action="#{viTriLuuTru.sua}">
			    	</a4j:commandButton>
			   		<a4j:commandButton type="Button" size="15" value="Hủy" styleClass="Button" action="#{viTriLuuTru.huyTao}"></a4j:commandButton>
			    </h:panelGrid>	
			     </h:form>
		</rich:panel>	
		<h:panelGrid columns="1" style="margin-left:0px;">		       		
		       		<h:outputText value="Danh sách vị trí lưu trữ" styleClass="inputText" ></h:outputText>		       			    		
				</h:panelGrid>
					
			<!-- Bat dau table -->
					<h:form>
					<h:dataTable id="list" value="#{viTriLuuTru.listViTriLuuTru}" var="Item" 
								columnClasses="column" headerClass="TableHeader" rowClasses="ROW1,ROW2" footerClass="TableFooter" 
					       style="width:100%; margin-left:0px;margin-top: 10px" cellspacing="1px;" rows="25">
						<h:column >
							<f:facet name="header">
								<h:outputText value="STT"></h:outputText>
							</f:facet>
							<h:outputText value="#{Item.stt}"></h:outputText>
							<f:facet name="footer">
								<rich:spacer></rich:spacer>
							</f:facet>
						</h:column>
						<h:column>
							<f:facet name="header">
								<h:outputText value="Tủ"></h:outputText>
							</f:facet>
							<h:outputText value="#{Item.viTriTu}"></h:outputText>
						</h:column>
						<h:column>
							<f:facet name="header">
								<h:outputText value="Ngăn tủ"></h:outputText>
							</f:facet>
							<h:outputText value="#{Item.nganTrongTu}"></h:outputText>
						</h:column>
						<h:column>
							<f:facet name="header">
								<h:outputText value="Mô tả"></h:outputText>
							</f:facet>
							<h:outputText value="#{Item.moTa}"></h:outputText>
						</h:column>
							
						<h:column>
							<f:facet name="header">
								<h:outputText value="Xóa" ></h:outputText>
							</f:facet>
							<a4j:commandLink  action="#{viTriLuuTru.xoaViTriLuuTru}"
											onclick="if(!confirm('Bạn muốn xóa vị trí lưu trữ này ?')) 
							 							{return false;}">
								<h:graphicImage value="/qldoanra/func01/images/icoDelete.gif"></h:graphicImage>
								<f:param name="id" value="#{Item.id}" />
								<f:param name="stt" value="#{Item.stt}" />
							</a4j:commandLink>
						</h:column>				
						<h:column>
							<f:facet name="header">
								<h:outputText value="Sửa"></h:outputText>
							</f:facet>
							 <a4j:commandLink  action="#{viTriLuuTru.suaViTriLuuTru}">
							 	<h:graphicImage value="/quantri/pqcn/images/icoEdit.gif"></h:graphicImage>
							 	<f:param name="id" value="#{Item.id}"/>
							 	<f:param name="viTriTu" value="#{Item.viTriTu}"/>
							 	<f:param name="nganTrongTu" value="#{Item.nganTrongTu}"/>
							 	<f:param name="moTa" value="#{Item.moTa}"/>
							 </a4j:commandLink>
						</h:column>
				
					</h:dataTable>
						<!-- phan trang -->
						<rich:datascroller align="right"  for="list" maxPages="5" />
						<!-- ket thuc phan trang -->			
				</h:form>		
	  </h:panelGrid>
   </h:panelGrid>  
 </ui:define>
</ui:composition> 
</body>	
</html>